home *** CD-ROM | disk | FTP | other *** search
- AskTask Documentation
-
- USAGE: asktask [<-opt>]
- where opt = c - use my default colors (the intended ones for
- this program). The previous colors are restored
- when asktask is terminated.
- p{n} - start with priority n. Asktask sets its own
- priority to a default of 15. This option will
- replace 15 with n. Note that the CLI launching
- asktask will get this priority too, and retains
- it even after asktask has terminated. I tend to
- use 'run asktask -p0'.
- NOTE: [] = optional, <> = 1 or more, {} = mandatory.
-
- DISCLAIMER: this program accesses important system data structures. It
- should never be used along with programs containing important, unsaved
- data, execpt in emergencies.
-
- PURPOSE:
- Asktask is intended to allow the user to examine various bits of
- the task structures of all the tasks in the system (except itself).
- These are accessed from the 'ready' and 'waiting' lists attached to
- ExecBase. The information displayed is:
- priority (task->tc_Node.ln_Pri)
- state (task->tc_State)
- flags (task->tc_Flags)
- stack (task->tc_SPReg, tc_SPLower, tc_SPUpper)
- Rg = register pointer.
- Up = upper address + 2.
- Lw = lower address.
- Sz = Size.
- Rm = Remaining space.
- (Note: if Rg doesn't lie between Up and Lw, then the task
- is no doubt a CLI process, where the Rg address is the
- command's stack pointer, not the CLI's.)
- signals (tc_SigAlloc, tc_SigWait, tc_SigRecvd, tc_Except)
- A = allocated signals.
- W = waiting signals.
- R = recieved signals.
- E = exception signals accepted.
- Some facilities for altering this data are also provided, but for the
- purpose of experimenting only!.
-
- OPERATION NOTES:
- -) You can select a task by clicking on its name.
- -) Asktask's internal task pointer array is not updated unless
- you use the refresh operation.
- -) Be aware that the CLI asktask is launched from gets asktask's
- priority of 15. So any other programs launched from that CLI
- will inherit this unusually large priority, perhaps interfering
- with asktask itself.
- -) A task may be paused by allocating a signal, and setting the
- corresponding wait signal bit, clearing the others. Starting it
- again is a problem though!
- -) RemTask() may be used to remove the current task. This unloads
- the task. This should not be used to kill tasks that are CLI
- commands, since the CLI is removed as well. (A CLI command
- doesn't seem to be a seperate task from its CLI; ie: the CLI
- does not fork off a new task to run commands, unless you use
- 'run' (or use WShell or some other shells background task option)
- to start the command).
- -) Exit() may be used to remove the current task. A context switch
- results in the task's pc address being stored on its stack.
- Asktask redirects this address to a piece of data within asktask
- that results in the task calling the DOS function Exit(). This
- should only be used to terminate CLI tasks that are currently
- running a command.
- -) The ABORT (CTRL-C) signal can be sent to the current task by
- setting the appropriate tc_SigRecvd bit (bit # 12 counting from
- zero). This is the preferred method for zapping CLI tasks, but
- only works if the task recognizes the signal. This is
- accomplished for Lattice C users during chkabort(), or level 2(?)
- IO routines. I recommend using the chkabort() and onbreak()
- functions.
- -) WARNING: try not to kill a task that owns some essential system
- resource, particularly the blitter. The removal may well happen
- before the task frees the resource, in which case deadlock city.
- Try reducing its priority instead.
- -) WARNING: try not to kill a task that waits for many messages from
- somebody else. For example, killing the clock program causes a
- 'Finish all disk activity - Task held' type requester to appear.
- While other programs will be unaffected, the CLI used to run
- the held task will be frozen.
- -) Note that asktask deals with tasks. Not processes. For those
- who don't know, a process is a task that has been launched by
- AmigaDOS (the CLI or Workbench), and hence has a process data
- structure associated with it as well as a task structure. Asktask
- does not care about this process structure, since tasks are the
- lowest level of multitasking, and while all processes have tasks,
- not all tasks have processes. A similar program could be written
- to get at processes through the DOSBase pointer.
- -) If you set a task's priority (using asktask) to something
- greater than asktask's, asktask will boost its own priority to
- the task's new priority plus 5. Hence the maximum priority you
- can set is 122 (127 - 5). This can be useful if some task has a
- priority that interferes with the system tasks. For instance,
- if you start test from the same CLI as asktask, and it thus
- inherits a priority of 15, because test does no waiting it will
- lock out the trackdisk.device and FileSystem tasks. In addition,
- it will not appear on asktask's task list. Why not I don't know,
- but it needs to have its priority reduced. To do this, you need
- to increase asktask's priority to something greater than 15. So
- selecting say the input.device, and changing its priority to 21
- will boost asktask's priority to 26, thus allowing you to control
- test with asktask. Because asktask spends most of its time
- waiting for your input, it is safe to set asktask's priority as
- high as you like.
- -) Questions can be sent to me at:
- J.Bickers,
- 214 Rata St,
- Naenae.
- Complaints can jump in the nearest lake.
-
- o/ o__
- | / __o _
- > > > \ \
- \o¸
- »»\««
-
- EXAMPLE:
- 1) run asktask.
- 2) make PopCLI III the current task by clicking on it.
- 3) select the SIGNAL operation, then press r for the Recvd signal
- bits. Set the 3 bits to the right of the leftmost two, and press
- return.
- 4) a newcli should appear (you have simulated the PopCLI hotkey).
- 5) start the 'test' program from the newcli. This program is an
- infinite loop:
- while (1) j++;
- 6) refresh the task list a few times to get the newcli task on the
- list, then select it as the current task.
- 7) select the Exit() operation, and press y.
- 8) the newcli prompt should reappear, test having been forced to
- terminate.
- NOTE: for some reason, endcli doesn't close down the new CLI
- console. Presumably because test has some files still open, such
- as its stdout, which is of course, the console!
-
- DISTRIBUTION:
- -) this program can be distributed freely, or for a maximum cost of
- copying + postage.
- -) this program cannot be ported to other, ridiculous, single-task
- machines, so there's no problem with that.
- -) feel free to alter or copy the code as you wish.
-
- SOURCE: The following files make up the source code -
- asktask.h at_input.c
- asktask.c at_kill.c
- at_gadg.c at_putdata.c
- at_help.c trans.c
- blink with asktask.lnk
-
- The following files are also included:
- asktask.doc
- test.c/test
-
- IMPORTANT NOTE: Discovered the task structure is actually contained
- WITHIN (at the start of) a process structure if that task is also
- a process. That is how Exit() knows which process... A pointer to
- a task structure is also a pointer to its process structure:
- see libraries/dosextens
-